package com.af.monitorModule.generator.entity;

import java.time.LocalDateTime;
import java.io.Serializable;

import com.af.monitorModule.common.MonitorTypeEnum;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 *
 * </p>
 *
 * @author lyz_4dou
 * @since 2021-02-23
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class Monitor implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 监控名称
     */
    private String monitorName;

    /**
     * 公司id
     */
    private Integer companyId;

    /**
     * 监控内容
     */
    private String monitorInner;

    /**
     * 心跳
     */
    private LocalDateTime heartbeat;

    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createDate;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateDate;

    private String remarks;

    private Integer state;

    @Version
    private Integer version;

    public Monitor() {
    }

    public Monitor(MonitorTypeEnum one){
        if (one == null){
            return;
        }
        this.monitorName = one.getMonitorName();
        this.monitorInner = one.getMonitorInner();
        this.remarks = one.getRemarks();
    }


}
